<?php

include 'sessioncheck.php';
include 'lang.php';

function tplload($name)
{
	$templates = ['header', 'footer'];

	if (!in_array($name, $templates))
		return false;

	$template = file('templates/'.$name.'.tpl');
	foreach ($template as $line)
	{
		while (1 === preg_match('/<\$[a-z]+ \/>/', $line, $matches))
		{
			$name = substr($matches[0], 2, -3);
			$line = str_replace ($matches[0], lang($name), $line);
		}

		echo $line;
	}

	return true;
}

?>
